package im.youni.horus.core;

public class SecondTag implements Cloneable {

    public long time;
    public String app;
    public String service;
    public String method;
    public String local;
    public int errorType;
    public int errorCode;
    public int errorCount;

    public SecondTag() {
    }

    public SecondTag(
            long time,
            String app,
            String service,
            String method,
            String local) {
        this.time = time;
        this.app = app;
        this.service = service;
        this.method = method;
        this.local = local;
    }

    public SecondTag(
            long time,
            String app,
            String service,
            String method,
            String local,
            int errorType,
            int errorCode) {
        this.time = time;
        this.app = app;
        this.service = service;
        this.method = method;
        this.local = local;
        this.errorType = errorType;
        this.errorCode = errorCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) return false;
        SecondTag cTag = (SecondTag) obj;
        if (this.app.equals(cTag.app)
                && this.service.equals(cTag.service)
                && this.method.equals(cTag.method)
                && this.local.equals(cTag.local)
                && this.time == cTag.time
                && this.errorType == cTag.errorType
                && this.errorCode == cTag.errorCode) {
            return true;
        }
        return false;
    }

    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + (int) time;
        result = 31 * result + (app == null ? 0 : app.hashCode());
        result = 31 * result + (service == null ? 0 : service.hashCode());
        result = 31 * result + (method == null ? 0 : method.hashCode());
        result = 31 * result + (local == null ? 0 : local.hashCode());
        result = 31 * result + errorType;
        result = 31 * result + errorCode;
        return result;
    }
}
